package _20_Exceptions;

public class Person 
{
	private String name;
	
	void setName(String name)
	{
		this.name = name;
	}
	
	boolean hasSameName(Person other)
	{
		try
		{
			int[] x = new int[3];
			x[10] = 4;
			
		return this.name.equals(other);
		}
		catch(NullPointerException e)
		{
			System.out.println("Problem with names.");
			
			for(StackTraceElement ste : e.getStackTrace())
			{
				System.out.println(ste.getMethodName() + ste.getLineNumber());
			}
			return false;
		}
		catch(ArrayIndexOutOfBoundsException e)
		{
			System.out.println("Wrong use of arrays.");
			
			return false;
			
		}
	}
}
